package compare.compare2;


import java.util.Arrays;
import java.util.Comparator;

class Student{
    public String name;
    public int age;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

}
public class Test {
    public static void main(String[] args) {
        Student[] students=new Student[]{
                new Student("zhansan",18),
                new Student("man",24),
                new Student("lebron",23)
        };
        AgeCompator ageCompator = new AgeCompator();
        Arrays.sort(students,ageCompator);
        System.out.println(Arrays.toString(students));
    }
}
